package pl.fiszkiapp.tutorial;

import pl.example.fiszkiapp.R;
import pl.example.fiszkiapp.R.array;
import pl.example.fiszkiapp.R.layout;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * Activity wywietlajaca liste tematow pomocy/samouczka
 * @author Piotr Czerwiec
 */
public class TutorialActivity extends ListActivity {
	private String[] topicList;
	
	public void onCreate(Bundle savedInstance){
		super.onCreate(savedInstance);
		//Tworzenie po prostu listy z tematami pomocy, ciagi znakow pobierane sa z
		//pliku res/values/strings.xml
		this.setContentView(R.layout.tutorial_layout);
		topicList = this.getResources().getStringArray(R.array.tematy_pomocy);
		
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
		android.R.layout.simple_list_item_1, topicList);
		setListAdapter(adapter);
	}
	
	@Override
	  public void onListItemClick(ListView l, View v, int position, long id) {
	    // Do something with the data
		super.onListItemClick(l, v, position, id);
		Intent pressed = new Intent(v.getContext(), LessonActivity.class);
		pressed.putExtra("num", (short) position);
		startActivity(pressed);	
	  }
	
}
